//
// Created by jerry on 2024/5/18.
//

#ifndef DS_EXP5_BINARY_TREE_H
#define DS_EXP5_BINARY_TREE_H

#include <stdio.h>
#include "stdlib.h"
#include "string.h"
#define MAXSIZE 0x100;
#define MALLOC(pointer,type,size) do{ \
pointer=(type*)malloc((size)*sizeof(type)); \
if(pointer==NULL){                    \
fprintf(stderr,"Malloc Error\n");     \
exit(1);                              \
}                                     \
memset(pointer,0,(size)*sizeof(type));\
}while(0);

#define Elemtype int

typedef struct binary_tree_node_{
    Elemtype data;
    struct binary_tree_node_ *left,*right;
}BinaryTreeNode;
typedef BinaryTreeNode *BinaryTree;

BinaryTreeNode *initBinaryTreeNode(Elemtype data);
void PreOrderTraverse(BinaryTree tree,int reverse);

#endif //DS_EXP5_BINARY_TREE_H
